package com.black.play.common;

import java.awt.*;
import java.io.File;
import java.io.IOException;
import java.net.URI;

/**
 * @author ylx
 */
public interface LinkAble {

    default void open(String path) throws IOException {
        File file = new File(path);
        if (!file.exists()){
            return;
        }
        Desktop.getDesktop().open(file);
    }

    default void browse(String url) throws IOException {
        URI uri = URI.create(url);
        Desktop.getDesktop().browse(uri);
    }
}
